package com.winit.core.mq.util;

import com.winit.common.util.SpringContextHolder;
import com.winit.core.mq.exchange.MessageExchange;
import com.winit.core.mq.message.Message;

import java.util.Map;

/**
 * mq消息发送工具类
 * Created by wangjian on 16/10/10.
 */
public class MqMessageSendUtil {

    /**
     * 发送mq消息
     * @param queueName
     * @param head
     * @param body
     * @param <T>
     */
    public static <T> void sendMqMessage(String queueName,Map head,T body){
        Message<T> me = new Message<>(head,body);
        MessageExchange messageExchange = SpringContextHolder.getBean(MessageExchange.class);
        messageExchange.sendMessage(queueName,me);
    }
}
